package com.twu.biblioteca;

import com.twu.biblioteca.menu.*;

public enum  Options {
    ALL_BOOKS(1){
        @Override
        public MenuOption getOption() {
            return new AllBooks();
        }
    },MEMBER_SHIP(2) {
        @Override
        public MenuOption getOption() {
            return new MemberShip();
        }
    }, MOVIES(3) {
        @Override
        public MenuOption getOption() {
            return new AllMovies();
        }
    }, RESERVE(4) {
        @Override
        public MenuOption getOption() {
            return new Reserve();
        }
    }, LOGIN(5) {
        @Override
        public MenuOption getOption() {
            return new Login();
        }
    }, EXIT(6) {
        @Override
        public MenuOption getOption() {
            return new Exit();
        }
    };
    private final int value;

    Options(int value) {
        this.value = value;
    }

    public static Options selected(int value) {
        for (Options options:Options.values()){
            if(value == options.value){
                return options;
            }
        }
        return null;
    }

    public static String display() {
        String menu = "";
        Integer number = 1;
        for (Options options:Options.values()){
            menu += number.toString()+"."+options.name() +"\n";
            number++;
        }
        return menu;
    }

    private MenuOption option;
    public abstract MenuOption getOption();
}